<?php

class Core
{
    //每注N个号码
    private static function generate($range, $numberCount)
    {
        while ($numberCount) {
            $keys = array_keys($range);
            $randIndex = rand(0, count($keys) - 1);
            $randKey = $keys[$randIndex];
            $result[] = $range[$randKey];
            unset($range[$randKey]);
            $numberCount--;
        }
        return $result;
    }

    //生成N注
    static function run($groupCount, $range, $numberCount)
    {
        while ($groupCount) {
            $numbers = self::generate($range, $numberCount);
            $result[] = $numbers;
            $groupCount--;
        }
        return $result;
    }
}



